'\" te
.\"  Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SIP_ADD_REQUEST_LINE 3SIP "Jan 25, 2007"
.SH NAME
sip_add_request_line, sip_add_response_line \- add a request/response line to a
SIP message
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsip\fR [ \fIlibrary\fR ... ]
#include <sip.h>

\fBint\fR \fBsip_add_request_line\fR(\fBsip_msg_t\fR \fIsip_request\fR,
     \fBsip_method_t\fR \fImethod\fR, \fBchar *\fR\fIrequest_uri\fR);
.fi

.LP
.nf
\fBint\fR \fIsip_add_response_line\fR(\fBsip_msg_t\fR \fIsip_response\fR,
     \fBint\fR \fIresponse_code\fR, \fBchar *\fR\fIresponse_phase\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBsip_add_request_line()\fR function adds a request line to the \fBSIP\fR
message \fIsip_request\fR. The request line is created using the \fBSIP\fR
method specified in \fImethod\fR and the \fBURI\fR in \fIrequest_uri\fR. The
\fBSIP\fR method can be one of the following:
.br
.in +2
\fBINVITE\fR
.in -2
.br
.in +2
\fBACK\fR
.in -2
.br
.in +2
\fBOPTIONS\fR
.in -2
.br
.in +2
\fBBYE\fR
.in -2
.br
.in +2
\fBCANCEL\fR
.in -2
.br
.in +2
\fBREGISTER\fR
.in -2
.br
.in +2
\fBREFER\fR
.in -2
.br
.in +2
\fBSUBSCRIBE\fR
.in -2
.br
.in +2
\fBNOTIFY\fR
.in -2
.br
.in +2
\fBPRACK\fR
.in -2
.br
.in +2
\fBINFO\fR
.in -2
.sp
.LP
The resulting request line has the \fBSIP\fR-Version of "2.0".
.sp
.LP
The \fBsip_add_response_line()\fR function adds a response line to the
\fBSIP\fR message \fIsip_response\fR. The response line is created using the
response code \fIresponse_code\fR and the phrase in \fIresponse_phrase\fR. If
the \fIresponse_code\fR is one that is listed in RFC 3261,
\fBsip_get_resp_desc()\fR can be used to get the response phase for the
\fIresponse_code\fR. The resulting response line has the \fBSIP\fR-Version of
"2.0".
.SH RETURN VALUES
.sp
.LP
The \fBsip_add_response_line()\fR and \fBsip_add_request_line()\fR functions
return \fB0\fR on success and the appropriate error value in case of failure.
.sp
.LP
The value of \fBerrno\fR is not changed by these calls in the event of an
error.
.SH ERRORS
.sp
.LP
On failure, the \fBsip_add_response_line()\fR and \fBsip_add_request_line()\fR
functions could return one of the following errors:
.sp
.ne 2
.na
\fBEINVAL\fR
.ad
.RS 11n
If mandatory input is not provided or if the input is invalid.
.RE

.sp
.ne 2
.na
\fBENOTSUP\fR
.ad
.RS 11n
If the input \fBSIP\fR message cannot be modified.
.RE

.sp
.ne 2
.na
\fBENOMEM\fR
.ad
.RS 11n
If memory allocation fails when creating the request/response line or when
creating headers in the \fBACK\fR request.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR libsip (3LIB)
